package lab04.test01;

/**
 * Created by ASUS on 2017/12/14.
 * 如何将一个普通的类变成一个线程？
 * 1.extends Thread
 * 2.implements Runnable
 */
public class HelloWorldThread extends Thread {

    @Override
    public void run(){
        //每隔一秒控制台输出hello，world

        while (true){

            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("Hello,world!");
        }

    }
}
